{% extends 'base.html' %}
{% block content %}
<div class="container mt-4">
    <h2>建筑物列表</h2>
    <div class="mb-3">
        <a href="{% url 'building-create' %}" class="btn btn-primary">添加建筑物</a>
        <a href="{% url 'building-export' %}" class="btn btn-success">导出Excel</a>
        <a href="{% url 'building-import' %}" class="btn btn-info">导入Excel</a>
    </div>
    <table class="table table-striped">
        <thead>
            <tr>
                <th>工程名称</th>
                <th>建筑物名称</th>
                <th>位置</th>
                <th>监测断面</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for building in buildings %}
            <tr>
                <td>{{ building.project.name }}</td>
                <td>{{ building.name }}</td>
                <td>{{ building.location }}</td>
                <td>{{ building.section }}</td>
                <td>
                    <a href="{% url 'building-detail' building.pk %}" class="btn btn-sm btn-info">查看</a>
                    <a href="{% url 'building-update' building.pk %}" class="btn btn-sm btn-warning">编辑</a>
                    <a href="{% url 'building-delete' building.pk %}" class="btn btn-sm btn-danger">删除</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}